import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import ChatView from '../views/ChatView.vue'
import ModelsView from '../views/ModelView.vue'
import PricingView from '../views/PricingView.vue'
import DashboardView from '../views/DashboardView.vue'
// import AuthGuard from '../middleware/auth-guard'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: HomeView
  },
  {
    path: '/chat',
    name: 'Chat',
    component: ChatView,
    // beforeEnter: AuthGuard
  },
  {
    path: '/models',
    name: 'Models',
    component: ModelsView,
    // beforeEnter: AuthGuard
  },
  {
    path: '/pricing',
    name: 'Pricing',
    component: PricingView
  },
  {
    path: '/dashboard',
    name: 'Dashboard',
    component: DashboardView,
    // beforeEnter: AuthGuard
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/LoginView.vue'),
    meta: { requiresGuest: true }
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/RegisterView.vue'),
    meta: { requiresGuest: true }
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return { top: 0 }
    }
  }
})

export default router
    